Field
Aspects of the present invention generally relate to an image processing method for performing image processing on an input image and storing data on the image associated with the image processing and an image processing apparatus.
Description of the Related Art
Image processing apparatuses that perform measurement of a position and a phase of a captured object, detection of a specific portion or an entire member, inspection of a surface state, quality inspection, and the like through image processing performed on an image captured by an image pickup apparatus (such as a digital still camera) have been widely used.
Such an image processing apparatus may include a storage device that stores (accumulates or logs) image data. As the storage device, an external storage device, such as a fixed or removable HDD (Hard Disk Drive) or SSD (Solid State Drive), is used. Such an image processing apparatus including a storage device that records image data may record image data to be processed or image data generated in image processing every time the image processing is performed.
Such an image processing apparatus may not obtain an expected result of image processing performed on a specific image, and accordingly, the image processing apparatus may require analysis of a cause and adjustment of processing parameters used in the image processing. In this case, if the image data is recorded (logged) in the storage device, inspection is easily performed on content of the image processing. Specifically, logging of image data associated with the image processing is useful for analysis of a cause at a time of trouble and preventive maintenance, and furthermore, useful for evaluation and consideration of validity at a time of the adjustment of the processing parameters.
However, in recent years, data on an image captured by a digital still camera or the like has a large amount of information per data, and accordingly, a large storage capacity is required for storing image data. In a case where data on images associated with image processing are to be stored for a long period of time or data on a large number of images associated with image processing are to be stored, for example, a storage device having an enormous capacity is required, and therefore, cost of the storage device is increased. Furthermore, as an amount of image data transmitted to the storage device becomes large, a load of data communication is increased, and accordingly, a data communication speed may negatively affect a processing speed of a system.
To address this, a method for cutting out (extracting) only a partial region of image data and storing the partial region in a storage device so that an amount of image data to be stored in the storage device is reduced has been proposed (refer to Japanese Patent Laid-Open No. 2004-333446, for example). In Japanese Patent Laid-Open No. 2004-333446, a mounting position of an object to be subjected to image processing is fixed in advance and a region to be inspected is extracted and stored in a storage device. For example, in image processing in which a plurality of objects are simultaneously inspected, a range including the plurality of entire objects may be captured once. In particular, a configuration described in Japanese Patent Laid-Open No. 2004-333446 limits an inspection region required for the image processing in advance in such a case and causes the storage device to store only the region so that an amount of data to be stored is reduced.
In the configuration described in Japanese Patent Laid-Open No. 2004-333446, mounting positions of the objects are fixed in advance, and image data in regions determined in advance in accordance with the positions is stored in the storage device. Therefore, for an application in which a mounting position of an object may not be accurately set in advance, a large image region to be subjected to the image processing (and accordingly a large image region to be stored in the storage device) is set. In this case, a large storage region is required for logging image data. For example, although an object is sufficiently small relative to an entire captured image, the object may move in inspection and the movement may not be stopped. In this case, a large image region to be subjected to the image processing and the logging of the image data is required to be set, and accordingly, a region required for storing the image data is unnecessarily increased.
Furthermore, to reduce a region required for storing data, compressed image data may be stored in a storage device. For example, various image data compression methods including a lossy compression method using discrete cosine transform (such as JPEG) and a lossy compression method using wavelet transform or the like (such as JPEG2000) have been used. When such a lossy compression method is employed, a large compression rate is obtained depending on a setting of an image quality parameter, and accordingly, a region for the logging in the storage device may be considerably reduced. However, it is possible that throughput of a system is degraded due to an image compression process when a size of the image data is large or when the number of images corresponding to the image data to be processed is large.
Furthermore, in the lossy compression method described above, although a region required for storing the image data may be efficiently reduced, once the image data is compressed, the original image data before compression may not be reproduced from the compressed image data. Furthermore, even when the compressed image is displayed or printed out, luminance information and color information of pixels included in the image data before compression may not be reproduced. Accordingly, even when the image processing is performed on the image data compressed by the lossy compression method, it is not necessarily the case that a processing result obtained when the image processing is performed on the image data that has not been compressed is obtained.
Therefore, use of the compressed image is not appropriate for changing and considering parameters associated with target image processing. Even when image processing is similarly performed on the image data that has not been compressed and the image data that has been subjected to the lossy compression to obtain matching positions of pattern matching, positions where a contour is detected, and extraction areas of regions, and the like, it is highly likely that different processing results are obtained. Furthermore, although degradation of image quality may be suppressed by appropriately setting parameters of a compression process in a specific lossy compression method, if the image quality is prioritized, a desired effect of reduction of a data amount may not be obtained on the other hand. Although lossless compression methods that do not degrade image quality have been used, in general, a compression rate that is as appropriate as that of the lossy compression methods is not obtained when such a lossless compression method is used.
To address the issues described above, when image data to be subjected to image processing is to be extracted and stored, a dynamic determination of an extraction position of the image data in accordance with content of the image processing and reduction of an amount of data to be stored when the image data to be subjected to the image processing is stored are enabled. Even when a position of an object is changed every time image data is input, the image data may be stored in a smaller region while reproducibility of a result of the image processing is maintained.